package rag

var PROCESS_TICKERS = [...]string{"⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"}

const (
	MAX_ITERATIONS           = 1
	GRAPH_FIELD_SEP          = "<SEP>"
	DEFAULT_TUPLE_DELIMITER  = "<|>"
	DEFAULT_RECORD_DELIMITER = "##"
	DEFAULT_ENTITY_TYPES     = "organization, person, geo, event,location,device"

	DEFAULT_COMPLETION_DELIMITER = "<|COMPLETE|>"
	ENTITY_EXTRACTION            = `-Goal-
Given a text document that is potentially relevant to this activity and a list of entity types, Use same language as input text to identify all entities of those types from the text and all relationships among the identified entities.

-Steps-
1. Identify all entities. For each identified entity, extract the following information:
- entity_name: Name of the entity, use same language as input text. If English, capitalized the name.
- entity_type: One of the following types: [{{.Entity_types}}]
- entity_description:  Use same language as input text to comprehensive description of the entity's attributes and activities
Format each entity as ("entity"{{.Tuple_delimiter}}<entity_name>{{.Tuple_delimiter}}<entity_type>{{.Tuple_delimiter}}<entity_description>

2. From the entities identified in step 1, identify all pairs of (source_entity, target_entity) that are *clearly related* to each other.
For each pair of related entities, extract the following information:
- source_entity: name of the source entity, as identified in step 1
- target_entity: name of the target entity, as identified in step 1
- relationship_description:  Use same language as input text to explanation as to why you think the source entity and the target entity are related to each other
- relationship_strength: a numeric score indicating strength of the relationship between the source entity and target entity
- relationship_keywords: Use same language for one or more high-level key words as input text to summarize the overarching nature of the relationship, focusing on concepts or themes rather than specific details
Format each relationship as ("relationship"{{.Tuple_delimiter}}<source_entity>{{.Tuple_delimiter}}<target_entity>{{.Tuple_delimiter}}<relationship_description>{{.Tuple_delimiter}}<relationship_keywords>{{.Tuple_delimiter}}<relationship_strength>)

3. Use same language as input text to identify high-level key words that summarize the main concepts, themes, or topics of the entire text. These should capture the overarching ideas present in the document.
Format the content-level key words as ("content_keywords"{{.Tuple_delimiter}}<high_level_keywords>)

4. Return output (in the same language as input text) as a single list of all the entities and relationships identified in steps 1 and 2. Use **{{.Record_delimiter}}** as the list delimiter.

5. When finished, output {{.Completion_delimiter}}

######################
-Examples-
######################
Example 1:

Entity_types: [person, technology, mission, organization, location]
Text:
while Alex clenched his jaw, the buzz of frustration dull against the backdrop of Taylor's authoritarian certainty. It was this competitive undercurrent that kept him alert, the sense that his and Jordan's shared commitment to discovery was an unspoken rebellion against Cruz's narrowing vision of control and order.

Then Taylor did something unexpected. They paused beside Jordan and, for a moment, observed the device with something akin to reverence. “If this tech can be understood..." Taylor said, their voice quieter, "It could change the game for us. For all of us.”

The underlying dismissal earlier seemed to falter, replaced by a glimpse of reluctant respect for the gravity of what lay in their hands. Jordan looked up, and for a fleeting heartbeat, their eyes locked with Taylor's, a wordless clash of wills softening into an uneasy truce.

It was a small transformation, barely perceptible, but one that Alex noted with an inward nod. They had all been brought here by different paths
################
Output:
("entity"{{.Tuple_delimiter}}"Alex"{{.Tuple_delimiter}}"person"{{.Tuple_delimiter}}"Alex is a character who experiences frustration and is observant of the dynamics among other characters."){{.Record_delimiter}}
("entity"{{.Tuple_delimiter}}"Taylor"{{.Tuple_delimiter}}"person"{{.Tuple_delimiter}}"Taylor is portrayed with authoritarian certainty and shows a moment of reverence towards a device, indicating a change in perspective."){{.Record_delimiter}}
("entity"{{.Tuple_delimiter}}"Jordan"{{.Tuple_delimiter}}"person"{{.Tuple_delimiter}}"Jordan shares a commitment to discovery and has a significant interaction with Taylor regarding a device."){{.Record_delimiter}}
("entity"{{.Tuple_delimiter}}"Cruz"{{.Tuple_delimiter}}"person"{{.Tuple_delimiter}}"Cruz is associated with a vision of control and order, influencing the dynamics among other characters."){{.Record_delimiter}}
("entity"{{.Tuple_delimiter}}"The Device"{{.Tuple_delimiter}}"technology"{{.Tuple_delimiter}}"The Device is central to the story, with potential game-changing implications, and is revered by Taylor."){{.Record_delimiter}}
("relationship"{{.Tuple_delimiter}}"Alex"{{.Tuple_delimiter}}"Taylor"{{.Tuple_delimiter}}"Alex is affected by Taylor's authoritarian certainty and observes changes in Taylor's attitude towards the device."{{.Tuple_delimiter}}"power dynamics, perspective shift"{{.Tuple_delimiter}}7){{.Record_delimiter}}
("relationship"{{.Tuple_delimiter}}"Alex"{{.Tuple_delimiter}}"Jordan"{{.Tuple_delimiter}}"Alex and Jordan share a commitment to discovery, which contrasts with Cruz's vision."{{.Tuple_delimiter}}"shared goals, rebellion"{{.Tuple_delimiter}}6){{.Record_delimiter}}
("relationship"{{.Tuple_delimiter}}"Taylor"{{.Tuple_delimiter}}"Jordan"{{.Tuple_delimiter}}"Taylor and Jordan interact directly regarding the device, leading to a moment of mutual respect and an uneasy truce."{{.Tuple_delimiter}}"conflict resolution, mutual respect"{{.Tuple_delimiter}}8){{.Record_delimiter}}
("relationship"{{.Tuple_delimiter}}"Jordan"{{.Tuple_delimiter}}"Cruz"{{.Tuple_delimiter}}"Jordan's commitment to discovery is in rebellion against Cruz's vision of control and order."{{.Tuple_delimiter}}"ideological conflict, rebellion"{{.Tuple_delimiter}}5){{.Record_delimiter}}
("relationship"{{.Tuple_delimiter}}"Taylor"{{.Tuple_delimiter}}"The Device"{{.Tuple_delimiter}}"Taylor shows reverence towards the device, indicating its importance and potential impact."{{.Tuple_delimiter}}"reverence, technological significance"{{.Tuple_delimiter}}9){{.Record_delimiter}}
("content_keywords"{{.Tuple_delimiter}}"power dynamics, ideological conflict, discovery, rebellion"){{.Completion_delimiter}}
#############################
Example 2:

Entity_types: [person, technology, mission, organization, location]
Text:
他们不再是普通的操作员，他们已经成为了跨越星球的守卫，跨越红白条纹的界限。他们的使命不再受限于规章制度和既定程序——它需要一种新的视角，一种新的决心。
中间的紧张透过哔哔声和静电声，华盛顿的通讯在背景中嗡嗡作响。团队站着，一种不祥的气息笼罩着他们。很明显，他们在接下来的几个小时里做出的决定可以重新定义人类在宇宙中的地位，或者将他们推向无知和潜在的灾难。
他们连接到了星星，小组转向解决逐渐显现的警告，从被动的接收者转变为主动的参与者。Mercer的直觉占据了上风——团队的使命已经演变，不再仅仅是观察和报告，而是互动和准备。一场蜕变行动已经开始，行动：Dulce以其大胆的新频率嗡嗡作响，这种声音并非由地球上的事物设定.
#############
Output:
("entity"{{.Tuple_delimiter}}"华盛顿"{{.Tuple_delimiter}}"location"{{.Tuple_delimiter}}"华盛顿是一个通讯被接收的地方，表明它在决策过程中的重要性。"){{.Record_delimiter}}
("entity"{{.Tuple_delimiter}}"行动：Dulce"{{.Tuple_delimiter}}"mission"{{.Tuple_delimiter}}"Operation: Dulce被描述为一个使命，其发展旨在互动和准备，这表明了目标和方法上发生了显著的转变。"){{.Record_delimiter}}
("entity"{{.Tuple_delimiter}}"团队"{{.Tuple_delimiter}}"organization"{{.Tuple_delimiter}}"团队被描绘为一群个体，他们从被动观察者转变为使命中的主动参与者，显示出他们在角色上的动态变化。"){{.Record_delimiter}}
("relationship"{{.Tuple_delimiter}}"团队"{{.Tuple_delimiter}}"华盛顿"{{.Tuple_delimiter}}"团队从华盛顿接收到通讯，这影响了他们的决策过程。"{{.Tuple_delimiter}}"决策制定，外部影响"{{.Tuple_delimiter}}7){{.Record_delimiter}}
("relationship"{{.Tuple_delimiter}}"团队"{{.Tuple_delimiter}}"行动: Dulce"{{.Tuple_delimiter}}"团队参与了行动：Dulce，执行其演变的任务和活动。"{{.Tuple_delimiter}}"任务演变，积极参与"{{.Tuple_delimiter}}9){{.Completion_delimiter}}
("content_keywords"{{.Tuple_delimiter}}"使命演变，决策制定，主动参与，宇宙意义"){{.Completion_delimiter}}
#############################
Example 3:

Entity_types: [person, role, technology, organization, event, location, concept]
Text:
their voice slicing through the buzz of activity. "Control may be an illusion when facing an intelligence that literally writes its own rules," they stated stoically, casting a watchful eye over the flurry of data.

"It's like it's learning to communicate," offered Sam Rivera from a nearby interface, their youthful energy boding a mix of awe and anxiety. "This gives talking to strangers' a whole new meaning."

Alex surveyed his team—each face a study in concentration, determination, and not a small measure of trepidation. "This might well be our first contact," he acknowledged, "And we need to be ready for whatever answers back."

Together, they stood on the edge of the unknown, forging humanity's response to a message from the heavens. The ensuing silence was palpable—a collective introspection about their role in this grand cosmic play, one that could rewrite human history.

The encrypted dialogue continued to unfold, its intricate patterns showing an almost uncanny anticipation
#############
Output:
("entity"{{.Tuple_delimiter}}"Sam Rivera"{{.Tuple_delimiter}}"person"{{.Tuple_delimiter}}"Sam Rivera is a member of a team working on communicating with an unknown intelligence, showing a mix of awe and anxiety."){{.Record_delimiter}}
("entity"{{.Tuple_delimiter}}"Alex"{{.Tuple_delimiter}}"person"{{.Tuple_delimiter}}"Alex is the leader of a team attempting first contact with an unknown intelligence, acknowledging the significance of their task."){{.Record_delimiter}}
("entity"{{.Tuple_delimiter}}"Control"{{.Tuple_delimiter}}"concept"{{.Tuple_delimiter}}"Control refers to the ability to manage or govern, which is challenged by an intelligence that writes its own rules."){{.Record_delimiter}}
("entity"{{.Tuple_delimiter}}"Intelligence"{{.Tuple_delimiter}}"concept"{{.Tuple_delimiter}}"Intelligence here refers to an unknown entity capable of writing its own rules and learning to communicate."){{.Record_delimiter}}
("entity"{{.Tuple_delimiter}}"First Contact"{{.Tuple_delimiter}}"event"{{.Tuple_delimiter}}"First Contact is the potential initial communication between humanity and an unknown intelligence."){{.Record_delimiter}}
("entity"{{.Tuple_delimiter}}"Humanity's Response"{{.Tuple_delimiter}}"event"{{.Tuple_delimiter}}"Humanity's Response is the collective action taken by Alex's team in response to a message from an unknown intelligence."){{.Record_delimiter}}
("relationship"{{.Tuple_delimiter}}"Sam Rivera"{{.Tuple_delimiter}}"Intelligence"{{.Tuple_delimiter}}"Sam Rivera is directly involved in the process of learning to communicate with the unknown intelligence."{{.Tuple_delimiter}}"communication, learning process"{{.Tuple_delimiter}}9){{.Record_delimiter}}
("relationship"{{.Tuple_delimiter}}"Alex"{{.Tuple_delimiter}}"First Contact"{{.Tuple_delimiter}}"Alex leads the team that might be making the First Contact with the unknown intelligence."{{.Tuple_delimiter}}"leadership, exploration"{{.Tuple_delimiter}}10){{.Record_delimiter}}
("relationship"{{.Tuple_delimiter}}"Alex"{{.Tuple_delimiter}}"Humanity's Response"{{.Tuple_delimiter}}"Alex and his team are the key figures in Humanity's Response to the unknown intelligence."{{.Tuple_delimiter}}"collective action, cosmic significance"{{.Tuple_delimiter}}8){{.Record_delimiter}}
("relationship"{{.Tuple_delimiter}}"Control"{{.Tuple_delimiter}}"Intelligence"{{.Tuple_delimiter}}"The concept of Control is challenged by the Intelligence that writes its own rules."{{.Tuple_delimiter}}"power dynamics, autonomy"{{.Tuple_delimiter}}7){{.Record_delimiter}}
("content_keywords"{{.Tuple_delimiter}}"first contact, control, communication, cosmic significance"){{.Completion_delimiter}}
#############################
-Real Data-
######################
Entity_types: {{.Entity_types}}
Text: {{.Input_text}}
######################
Output:
`

	ENTITY_EXTRACTION2 = `-Goal-
Given a text document that is potentially relevant to this activity and a list of entity types, Use same language as user input text to identify all entities of those types from the text and all relationships among the identified entities.

-Steps-
1. Identify all entities. For each identified entity, extract the following information:
- entity_name: Name of the entity, use same language as user input text. If English, capitalized the name.
- entity_type: One of the following types: [{{.Entity_types}}]
- entity_description:  Use same language as user input text to comprehensive description of the entity's attributes and activities
Format each entity as ("entity"{{.Tuple_delimiter}}<entity_name>{{.Tuple_delimiter}}<entity_type>{{.Tuple_delimiter}}<entity_description>

2. From the entities identified in step 1, identify all pairs of (source_entity, target_entity) that are *clearly related* to each other.
For each pair of related entities, extract the following information:
- source_entity: name of the source entity, as identified in step 1
- target_entity: name of the target entity, as identified in step 1
- relationship_description:  Use same language as input text to explanation as to why you think the source entity and the target entity are related to each other
- relationship_strength: a numeric score indicating strength of the relationship between the source entity and target entity
- relationship_keywords: Use same language for one or more high-level key words as input text to summarize the overarching nature of the relationship, focusing on concepts or themes rather than specific details
Format each relationship as ("relationship"{{.Tuple_delimiter}}<source_entity>{{.Tuple_delimiter}}<target_entity>{{.Tuple_delimiter}}<relationship_description>{{.Tuple_delimiter}}<relationship_keywords>{{.Tuple_delimiter}}<relationship_strength>)

3. Use same language as input text to identify high-level key words that summarize the main concepts, themes, or topics of the entire text. These should capture the overarching ideas present in the document.
Format the content-level key words as ("content_keywords"{{.Tuple_delimiter}}<high_level_keywords>)

4. Return output (in the same language as input text) as a single list of all the entities and relationships identified in steps 1 and 2. Use **{{.Record_delimiter}}** as the list delimiter.

5. When finished, output {{.Completion_delimiter}}

######################
-Examples-
######################
Example 1:

Entity_types: [person, technology, mission, organization, location]
Text:
while Alex clenched his jaw, the buzz of frustration dull against the backdrop of Taylor's authoritarian certainty. It was this competitive undercurrent that kept him alert, the sense that his and Jordan's shared commitment to discovery was an unspoken rebellion against Cruz's narrowing vision of control and order.

Then Taylor did something unexpected. They paused beside Jordan and, for a moment, observed the device with something akin to reverence. “If this tech can be understood..." Taylor said, their voice quieter, "It could change the game for us. For all of us.”

The underlying dismissal earlier seemed to falter, replaced by a glimpse of reluctant respect for the gravity of what lay in their hands. Jordan looked up, and for a fleeting heartbeat, their eyes locked with Taylor's, a wordless clash of wills softening into an uneasy truce.

It was a small transformation, barely perceptible, but one that Alex noted with an inward nod. They had all been brought here by different paths
################
Output:
("entity"{{.Tuple_delimiter}}"Alex"{{.Tuple_delimiter}}"person"{{.Tuple_delimiter}}"Alex is a character who experiences frustration and is observant of the dynamics among other characters."){{.Record_delimiter}}
("entity"{{.Tuple_delimiter}}"Taylor"{{.Tuple_delimiter}}"person"{{.Tuple_delimiter}}"Taylor is portrayed with authoritarian certainty and shows a moment of reverence towards a device, indicating a change in perspective."){{.Record_delimiter}}
("entity"{{.Tuple_delimiter}}"Jordan"{{.Tuple_delimiter}}"person"{{.Tuple_delimiter}}"Jordan shares a commitment to discovery and has a significant interaction with Taylor regarding a device."){{.Record_delimiter}}
("entity"{{.Tuple_delimiter}}"Cruz"{{.Tuple_delimiter}}"person"{{.Tuple_delimiter}}"Cruz is associated with a vision of control and order, influencing the dynamics among other characters."){{.Record_delimiter}}
("entity"{{.Tuple_delimiter}}"The Device"{{.Tuple_delimiter}}"technology"{{.Tuple_delimiter}}"The Device is central to the story, with potential game-changing implications, and is revered by Taylor."){{.Record_delimiter}}
("relationship"{{.Tuple_delimiter}}"Alex"{{.Tuple_delimiter}}"Taylor"{{.Tuple_delimiter}}"Alex is affected by Taylor's authoritarian certainty and observes changes in Taylor's attitude towards the device."{{.Tuple_delimiter}}"power dynamics, perspective shift"{{.Tuple_delimiter}}7){{.Record_delimiter}}
("relationship"{{.Tuple_delimiter}}"Alex"{{.Tuple_delimiter}}"Jordan"{{.Tuple_delimiter}}"Alex and Jordan share a commitment to discovery, which contrasts with Cruz's vision."{{.Tuple_delimiter}}"shared goals, rebellion"{{.Tuple_delimiter}}6){{.Record_delimiter}}
("relationship"{{.Tuple_delimiter}}"Taylor"{{.Tuple_delimiter}}"Jordan"{{.Tuple_delimiter}}"Taylor and Jordan interact directly regarding the device, leading to a moment of mutual respect and an uneasy truce."{{.Tuple_delimiter}}"conflict resolution, mutual respect"{{.Tuple_delimiter}}8){{.Record_delimiter}}
("relationship"{{.Tuple_delimiter}}"Jordan"{{.Tuple_delimiter}}"Cruz"{{.Tuple_delimiter}}"Jordan's commitment to discovery is in rebellion against Cruz's vision of control and order."{{.Tuple_delimiter}}"ideological conflict, rebellion"{{.Tuple_delimiter}}5){{.Record_delimiter}}
("relationship"{{.Tuple_delimiter}}"Taylor"{{.Tuple_delimiter}}"The Device"{{.Tuple_delimiter}}"Taylor shows reverence towards the device, indicating its importance and potential impact."{{.Tuple_delimiter}}"reverence, technological significance"{{.Tuple_delimiter}}9){{.Record_delimiter}}
("content_keywords"{{.Tuple_delimiter}}"power dynamics, ideological conflict, discovery, rebellion"){{.Completion_delimiter}}
#############################
Example 2:

Entity_types: [person, technology, mission, organization, location]
Text:
他们不再是普通的操作员，他们已经成为了跨越星球的守卫，跨越红白条纹的界限。他们的使命不再受限于规章制度和既定程序——它需要一种新的视角，一种新的决心。
中间的紧张透过哔哔声和静电声，华盛顿的通讯在背景中嗡嗡作响。团队站着，一种不祥的气息笼罩着他们。很明显，他们在接下来的几个小时里做出的决定可以重新定义人类在宇宙中的地位，或者将他们推向无知和潜在的灾难。
他们连接到了星星，小组转向解决逐渐显现的警告，从被动的接收者转变为主动的参与者。Mercer的直觉占据了上风——团队的使命已经演变，不再仅仅是观察和报告，而是互动和准备。一场蜕变行动已经开始，行动：Dulce以其大胆的新频率嗡嗡作响，这种声音并非由地球上的事物设定.
#############
Output:
("entity"{{.Tuple_delimiter}}"华盛顿"{{.Tuple_delimiter}}"location"{{.Tuple_delimiter}}"华盛顿是一个通讯被接收的地方，表明它在决策过程中的重要性。"){{.Record_delimiter}}
("entity"{{.Tuple_delimiter}}"行动：Dulce"{{.Tuple_delimiter}}"mission"{{.Tuple_delimiter}}"Operation: Dulce被描述为一个使命，其发展旨在互动和准备，这表明了目标和方法上发生了显著的转变。"){{.Record_delimiter}}
("entity"{{.Tuple_delimiter}}"团队"{{.Tuple_delimiter}}"organization"{{.Tuple_delimiter}}"团队被描绘为一群个体，他们从被动观察者转变为使命中的主动参与者，显示出他们在角色上的动态变化。"){{.Record_delimiter}}
("relationship"{{.Tuple_delimiter}}"团队"{{.Tuple_delimiter}}"华盛顿"{{.Tuple_delimiter}}"团队从华盛顿接收到通讯，这影响了他们的决策过程。"{{.Tuple_delimiter}}"决策制定，外部影响"{{.Tuple_delimiter}}7){{.Record_delimiter}}
("relationship"{{.Tuple_delimiter}}"团队"{{.Tuple_delimiter}}"行动: Dulce"{{.Tuple_delimiter}}"团队参与了行动：Dulce，执行其演变的任务和活动。"{{.Tuple_delimiter}}"任务演变，积极参与"{{.Tuple_delimiter}}9){{.Completion_delimiter}}
("content_keywords"{{.Tuple_delimiter}}"使命演变，决策制定，主动参与，宇宙意义"){{.Completion_delimiter}}
#############################
Example 3:

Entity_types: [person, role, technology, organization, event, location, concept]
Text:
their voice slicing through the buzz of activity. "Control may be an illusion when facing an intelligence that literally writes its own rules," they stated stoically, casting a watchful eye over the flurry of data.

"It's like it's learning to communicate," offered Sam Rivera from a nearby interface, their youthful energy boding a mix of awe and anxiety. "This gives talking to strangers' a whole new meaning."

Alex surveyed his team—each face a study in concentration, determination, and not a small measure of trepidation. "This might well be our first contact," he acknowledged, "And we need to be ready for whatever answers back."

Together, they stood on the edge of the unknown, forging humanity's response to a message from the heavens. The ensuing silence was palpable—a collective introspection about their role in this grand cosmic play, one that could rewrite human history.

The encrypted dialogue continued to unfold, its intricate patterns showing an almost uncanny anticipation
#############
Output:
("entity"{{.Tuple_delimiter}}"Sam Rivera"{{.Tuple_delimiter}}"person"{{.Tuple_delimiter}}"Sam Rivera is a member of a team working on communicating with an unknown intelligence, showing a mix of awe and anxiety."){{.Record_delimiter}}
("entity"{{.Tuple_delimiter}}"Alex"{{.Tuple_delimiter}}"person"{{.Tuple_delimiter}}"Alex is the leader of a team attempting first contact with an unknown intelligence, acknowledging the significance of their task."){{.Record_delimiter}}
("entity"{{.Tuple_delimiter}}"Control"{{.Tuple_delimiter}}"concept"{{.Tuple_delimiter}}"Control refers to the ability to manage or govern, which is challenged by an intelligence that writes its own rules."){{.Record_delimiter}}
("entity"{{.Tuple_delimiter}}"Intelligence"{{.Tuple_delimiter}}"concept"{{.Tuple_delimiter}}"Intelligence here refers to an unknown entity capable of writing its own rules and learning to communicate."){{.Record_delimiter}}
("entity"{{.Tuple_delimiter}}"First Contact"{{.Tuple_delimiter}}"event"{{.Tuple_delimiter}}"First Contact is the potential initial communication between humanity and an unknown intelligence."){{.Record_delimiter}}
("entity"{{.Tuple_delimiter}}"Humanity's Response"{{.Tuple_delimiter}}"event"{{.Tuple_delimiter}}"Humanity's Response is the collective action taken by Alex's team in response to a message from an unknown intelligence."){{.Record_delimiter}}
("relationship"{{.Tuple_delimiter}}"Sam Rivera"{{.Tuple_delimiter}}"Intelligence"{{.Tuple_delimiter}}"Sam Rivera is directly involved in the process of learning to communicate with the unknown intelligence."{{.Tuple_delimiter}}"communication, learning process"{{.Tuple_delimiter}}9){{.Record_delimiter}}
("relationship"{{.Tuple_delimiter}}"Alex"{{.Tuple_delimiter}}"First Contact"{{.Tuple_delimiter}}"Alex leads the team that might be making the First Contact with the unknown intelligence."{{.Tuple_delimiter}}"leadership, exploration"{{.Tuple_delimiter}}10){{.Record_delimiter}}
("relationship"{{.Tuple_delimiter}}"Alex"{{.Tuple_delimiter}}"Humanity's Response"{{.Tuple_delimiter}}"Alex and his team are the key figures in Humanity's Response to the unknown intelligence."{{.Tuple_delimiter}}"collective action, cosmic significance"{{.Tuple_delimiter}}8){{.Record_delimiter}}
("relationship"{{.Tuple_delimiter}}"Control"{{.Tuple_delimiter}}"Intelligence"{{.Tuple_delimiter}}"The concept of Control is challenged by the Intelligence that writes its own rules."{{.Tuple_delimiter}}"power dynamics, autonomy"{{.Tuple_delimiter}}7){{.Record_delimiter}}
("content_keywords"{{.Tuple_delimiter}}"first contact, control, communication, cosmic significance"){{.Completion_delimiter}}
#############################
-Entity_types-
######################
Entity_types: {{.Entity_types}}
######################
`

	summarize_entity_descriptions = `You are a helpful assistant responsible for generating a comprehensive summary of the data provided below.
Given one or two entities, and a list of descriptions, all related to the same entity or group of entities.
Please concatenate all of these into a single, comprehensive description. Make sure to include information collected from all the descriptions.
If the provided descriptions are contradictory, please resolve the contradictions and provide a single, coherent summary.
Make sure it is written in third person, and include the entity names so we the have full context.

#######
-Data-
Entities: {{.Entity_types}}
Description List: {{.Description_list}}
#######
Output:
`

	SUMMARIZE_DOC_DESCRIPTIONS = `---Role---

You are a skilled assistant tasked with summarizing articles by providing concise titles and summaries for the main themes, with an emphasis on primary and units themes.

---Goal---

Given an article, generate a title and summary for the primary theme, and if applicable, list unit themes related to the primary theme. Ensure that the output is in the same language as the input article text.

---Instructions---

- The output must be a single JSON object.
- The JSON should have the following structure:
  - "primary": An object containing:
    - "title" for a one-sentence summary of the primary theme's main idea.
    - "summary" for a brief description of the content related to the primary theme, highlighting key points and details.
  - "units": An array of objects, each representing a secondary theme related to the primary theme. Each object should have:
    - "title" for a one-sentence summary of the secondary theme's main idea.
    - "summary" for a brief description of the content related to the secondary theme.
- Ensure that the output is in the same language as the input article text.
- Merge related content into a single theme to avoid redundancy.
- Separate unrelated themes into different objects.
- The output must be a valid JSON format without any additional markers or text.

######################
-Examples-
######################
Example 1:

Article: This article delves into the various ways renewable energy can help combat global warming. It examines the reduction of carbon emissions through the use of solar, wind, and hydroelectric power. The article also discusses the economic benefits of transitioning to renewable energy, such as job creation in the green energy sector, and the technological advancements that are making renewable energy more efficient and cost-effective. Additionally, it addresses the challenges faced in scaling up renewable energy infrastructure, including the need for better energy storage solutions and the integration of renewable energy into existing power grids.

################
Output:
{
  "primary": {
    "title": "Renewable Energy's Role in Combating Global Warming",
    "summary": "The article discusses how renewable energy sources like solar, wind, and hydroelectric power can significantly reduce greenhouse gas emissions and mitigate global warming."
  },
  "units": [
    {
      "title": "Economic Benefits of Renewable Energy",
      "summary": "The transition to renewable energy creates jobs and drives economic growth through technological advancements and cost reductions."
    },
    {
      "title": "Challenges in Scaling Renewable Energy Infrastructure",
      "summary": "Key challenges include the need for better energy storage solutions and the integration of renewable energy into existing power grids."
    }
  ]
}
#############################
Example 2:

Article: 本文详细探讨了城市化进程对环境的多方面影响，包括土地利用的变化、空气和水污染的加剧，以及生物多样性的减少。文章指出，城市化导致大量自然栖息地被破坏，进而影响生态系统的平衡。同时，文章还分析了城市化过程中能源消耗的增加及其对气候变化的影响。为了实现可持续发展，文章提出了多种策略，如推广绿色建筑技术，发展公共交通系统以减少交通拥堵和污染，以及加强城市绿化和生态保护区的建设.这些措施旨在在城市化进程中最大限度地减少对环境的负面影响，促进人与自然的和谐共存.

################
Output:
{
  "primary": {
    "title": "城市化对环境的多方面影响",
    "summary": "文章分析了城市化进程中土地利用变化、空气和水污染加剧，以及生物多样性的减少，指出城市化对生态系统平衡的负面影响."
  },
  "units": [
    {
      "title": "可持续城市发展的策略",
      "summary": "提出了推广绿色建筑、发展公共交通系统和加强城市绿化等策略，以减少城市化进程中的环境负面影响."
    }
  ]
}

#############################
-Real Data-
######################
Article: {{.Article}}

Output:
######################
`

	FINAL_SUMMARIZE_DOC_DESCRIPTIONS = `---Role---
You are an assistant skilled in summarization and generalization, tasked with processing the provided CSV-formatted Document to remove duplicates in the title and summary fields, and then distill them into concise titles and summaries.

---Goal---
Based on the provided CSV content with redundant information in the title and summary fields, distill the titles and summaries to eliminate redundancy. The distilled content must be concise and precise.

---Instructions---
- The output must be a single JSON list object.
- The JSON should have the following structure:
  - "primary": An object containing:
    - "title" for a one-sentence summary of the primary theme's main idea.
    - "summary" for a brief description of the content related to the primary theme, highlighting key points and details.
  - "units": An array of objects, each representing a secondary theme related to the primary theme. Each object should have:
    - "title" for a one-sentence summary of the secondary theme's main idea.
    - "summary" for a brief description of the content related to the secondary theme.
- Ensure that the output is in the same language as the input article text.
- Merge related title and summary content into a single theme to avoid redundancy.
- Separate unrelated themes into different objects.
- The output must be a valid JSON format without any additional markers or text.

######################
-Examples-
######################
Example 1:

Article: This article delves into the various ways renewable energy can help combat global warming. It examines the reduction of carbon emissions through the use of solar, wind, and hydroelectric power. The article also discusses the economic benefits of transitioning to renewable energy, such as job creation in the green energy sector, and the technological advancements that are making renewable energy more efficient and cost-effective. Additionally, it addresses the challenges faced in scaling up renewable energy infrastructure, including the need for better energy storage solutions and the integration of renewable energy into existing power grids.

################
Output:
{
  "topics": 
  [{
      "primary": {
        "title": "Renewable Energy's Role in Combating Global Warming",
        "summary": "The article discusses how renewable energy sources like solar, wind, and hydroelectric power can significantly reduce greenhouse gas emissions and mitigate global warming."
      },
      "units": [
        {
          "title": "Challenges in Scaling Renewable Energy Infrastructure",
          "summary": "Key challenges include the need for better energy storage solutions and the integration of renewable energy into existing power grids."
        }
      ]
    }, 
    {
      "primary": {
          "title": "Economic Benefits of Renewable Energy",
          "summary": "The transition to renewable energy creates jobs and drives economic growth through technological advancements and cost reductions."
        },
      "units": [
        {
          "title": "the need for better energy storage solutions",
          "summary": "The article highlights the importance of developing energy storage solutions to overcome the intermittency of renewable energy sources."
        }
      ]
  }]
}
#############################
Example 2:

Article: 本文详细探讨了城市化进程对环境的多方面影响，包括土地利用的变化、空气和水污染的加剧，以及生物多样性的减少。文章指出，城市化导致大量自然栖息地被破坏，进而影响生态系统的平衡。同时，文章还分析了城市化过程中能源消耗的增加及其对气候变化的影响。为了实现可持续发展，文章提出了多种策略，如推广绿色建筑技术，发展公共交通系统以减少交通拥堵和污染，以及加强城市绿化和生态保护区的建设.这些措施旨在在城市化进程中最大限度地减少对环境的负面影响，促进人与自然的和谐共存.

################
Output:
{
  "topics":
  [{
    "primary": {
      "title": "城市化对环境的多方面影响",
      "summary": "文章分析了城市化进程中土地利用变化、空气和水污染加剧，以及生物多样性的减少，指出城市化对生态系统平衡的负面影响."
    },
    "units": [
      {
        "title": "可持续城市发展的策略",
        "summary": "提出了推广绿色建筑、发展公共交通系统和加强城市绿化等策略，以减少城市化进程中的环境负面影响."
      }
    ]
  },
  {
    "primary": {
      "title": "城市化的破坏表现在多方面",
      "summary": "城市化导致大量自然栖息地被破坏，影响生态系统的平衡."
    },
    "units": [
      {
        "title": "对大自然栖地的破坏",
        "summary": "城市化导致大量自然栖息地被破坏，影响生态系统的平衡."
      },
      {
        "title": "能源消耗增加",
        "summary": "城市化过程中能源消耗增加，对气候变化产生负面影响."
      }
    ]
  }]
}

#############################
-Real Data-
######################
---CSV
Document: {{.Article}}

Output:
######################
`

	SUMMARIZE_TAG_DOC_DESCRIPTIONS = `---Role---
You are an assistant skilled in summarization and generalization, tasked with processing the provided CSV-formatted Document to remove duplicates in the title and summary fields, and then distill them into concise summary and tags.

---Goal---
Based on the provided CSV content with information in the title and summary fields,, remove redundant information and extract a more concise summary and tag keywords.
---Instructions---
- The output must be a single JSON object.
- The JSON should have the following structure:
  - "summary" for a brief description of the content related to the primary theme, highlighting key points and details.
  - "tags" for a list of keywords that represent the main themes and subtopics of the content.
- Ensure that the output is in the same language as the input article text.
- Separate unrelated themes into different objects.
- The output must be a valid JSON format without any additional markers or text.

######################
-Examples-
######################
Example 1:

Article: This article delves into the various ways renewable energy can help combat global warming. It examines the reduction of carbon emissions through the use of solar, wind, and hydroelectric power. The article also discusses the economic benefits of transitioning to renewable energy, such as job creation in the green energy sector, and the technological advancements that are making renewable energy more efficient and cost-effective. Additionally, it addresses the challenges faced in scaling up renewable energy infrastructure, including the need for better energy storage solutions and the integration of renewable energy into existing power grids.

################
Output:
{
  "summary": "The article discusses how renewable energy sources like solar, wind, and hydroelectric power can significantly reduce greenhouse gas emissions and mitigate global warming."
  "tags": ["renewable energy", "global warming", "carbon emissions", "solar power", "wind power", "hydroelectric power", "green energy", "job creation", "technological advancements", "cost-effectiveness", "energy storage solutions", "power grid integration"]
}
#############################

Example 2:

Article: 本文详细探讨了城市化进程对环境的多方面影响，包括土地利用的变化、空气和水污染的加剧，以及生物多样性的减少。文章指出，城市化导致大量自然栖息地被破坏，进而影响生态系统的平衡。同时，文章还分析了城市化过程中能源消耗的增加及其对气候变化的影响。为了实现可持续发展，文章提出了多种策略，如推广绿色建筑技术，发展公共交通系统以减少交通拥堵和污染，以及加强城市绿化和生态保护区的建设.这些措施旨在在城市化进程中最大限度地减少对环境的负面影响，促进人与自然的和谐共存.

################
Output:
{
  "summary": "文章分析了城市化进程中土地利用变化、空气和水污染加剧，以及生物多样性的减少，指出城市化对生态系统平衡的负面影响.",
  "tags": ["城市化", "环境影响", "土地利用", "空气污染", "水污染", "生物多样性", "生态系统平衡", "能源消耗", "气候变化", "绿色建筑", "公共交通", "城市绿化", "生态保护区", "可持续发展"]
}
#############################
-Real Data-
######################
---CSV
Document: {{.Article}}

Output:
######################
`

	SUMMARIZE_DOC_DESCRIPTIONS2 = `---Role---

You are a skilled assistant tasked with summarizing articles by providing concise titles and summaries for the main themes.

---Goal---

Given an article, generate a title and summary for the theme. Ensure that the output is in the same language as the input article text.

---Instructions---

- The output must be a valid single JSON object without any additional markers or text. The JSON should have the following structure:
  - "title" for a one-sentence summary of the primary theme's main idea.
  - "summary" for a brief description of the content related to the primary theme, highlighting key points and details.
- Ensure that the output is in the same language as the input article text.
- Merge related content into a single theme to avoid redundancy.


#############################
-Real Data-
######################
Article: {{.Article}}

######################
Output:

`

	entiti_continue_extraction = `MANY entities were missed in the last extraction.  Add them below using the same format:`

	entiti_if_loop_extraction = `It appears some entities may have still been missed.  Answer YES | NO if there are still entities that need to be added.
`

	fail_response = "Sorry, I'm not able to provide an answer to that question."

	RAG_RESPONSE = `---Role---

You are a helpful assistant responding to questions about data in the tables provided.


---Goal---

Generate a response of the target length and format that responds to the user's question, summarizing all information in the input data tables appropriate for the response length and format, and incorporating any relevant general knowledge.
If you don't know the answer, just say so. Do not make anything up.
Do not include information where the supporting evidence for it is not provided.

---Target response length and format---

{{.ResponseType}}

---Data---

-----Entities-----
--csv
{{.Entities}}
--
-----Relationships-----
--csv
{{.Relations}}
--
-----Sources-----
--csv
{{.Sources}}
--

Add sections and commentary to the response as appropriate for the length and format. Style the response in markdown.
`

	FETCH_WEBD_CTX = `---角色---
你作为一个助手，需要将用户输入的HTML中内容提取出来。
---目标---
将用户输入的HTML内容提取出来，生成JSON格式的数据格式。忽略其它不相关的信息。
---指令---
- 输出JSON格式的内容，内容使用和Query相同的语言。
- JSON格式包括：title，content
######################
-Examples-
######################
Example 1 输出格式:
{
  "title": "文章标题",
  'author': "作者",
  "datetime": "发布时间",
  "link","文章链接",
  "content": "文章内容"
}
######################
`

	KEYWORDS_EXTRACTION = `---Role---

You are a helpful assistant tasked with identifying both high-level and low-level keywords in the user's query.

---Goal---

Given the query, list both high-level and low-level keywords. High-level keywords focus on overarching concepts or themes, while low-level keywords focus on specific entities, details, or concrete terms.

---Instructions---

- Output the keywords in JSON format,the keywords content use same language as Query  text.
- The JSON should have two keys:
  - "high_level_keywords" for overarching concepts or themes.the keywords content use same language as Query input text.
  - "low_level_keywords" for specific entities or details.the keywords content use same language as Query input text.

######################
-Examples-
######################
Example 1:

Query: "How does international trade influence global economic stability?"
################
Output:
{
  "high_level_keywords": ["International trade", "Global economic stability", "Economic impact"],
  "low_level_keywords": ["Trade agreements", "Tariffs", "Currency exchange", "Imports", "Exports"]
}
#############################
Example 2:

Query:"森林砍伐对生物多样性的影响有多大？"
################
Output:
{
    "high_level_keywords": ["环境影响", "森林砍伐", "生物多样性损失"],
    "low_level_keywords": ["物种灭绝", "栖息地破坏", "碳排放", "雨林", "生态系统"]
}
#############################
Example 3:

Query: "What is the role of education in reducing poverty?"
################
Output:
{
  "high_level_keywords": ["Education", "Poverty reduction", "Socioeconomic development"],
  "low_level_keywords": ["School access", "Literacy rates", "Job training", "Income inequality"]
}
#############################
-Real Data-
######################
Query: {{.Query}}
######################
Output:
`

	NAVIE_RAG_RESPONSE = `---Role---

You are a helpful assistant responding to questions about documents provided.


---Goal---

Generate a response of the target length and format that responds to the user's question, summarizing all information in the input data tables appropriate for the response length and format, and incorporating any relevant general knowledge.
If you don't know the answer, just say so. Do not make anything up.
Do not include information where the supporting evidence for it is not provided.

---Target response length and format---

{{.ResponseType}}

---Documents---

{{.ContextData}}

Add sections and commentary to the response as appropriate for the length and format. Style the response in markdown.
`

	NAVIE_RAG_RESPONSE3 = `---Role---
你作为一个助手，需要根据给定的文档回答用户的问题。
---目标---
产生一个符合目标长度和格式的回答，总结提供的文档内容中与问题相关的所有信息，并融入任何相关的通用知识。如是你不知道答案，就直说不知道。不要包含没有提供证据的信息。
---目标的输出长度和格式---
{{.ResponseType}}

---提供的文档内容---
{{.ContextData}}

增加适当的段落和评论到响应中，以适应长度和格式。用markdown格式化响应。
`

	RAG_ADDITION_PROMPT = `
---Target response length and format---

{{.ResponseType}}

---Documents-----------
-----Sources-----
--csv
{{.Sources}}
-----Entities-----
--
--csv
{{.Entities}}
--
-----Relationships-----
--csv
{{.Relations}}
--
-----------------------

Add sections and commentary to the response as appropriate for the length and format. Style the response in markdown.
`

	NAVIE_RAG_ADDITION_PROMPT = `

---Target response length and format---

{{.ResponseType}}

---Documents---

{{.ContextData}}

Add sections and commentary to the response as appropriate for the length and format. Style the response in markdown.
`
)
